﻿@model AexoManager.Models.RegistroEstadisticaViewModel

@{
    ViewBag.Title = "RegistroEstadisticas";
    Layout = "~/Views/Shared/_Template.cshtml";
}

@functions {
    object getHtmlAttributes(bool ReadOnly, string CssClass, string PlaceHolder)
    {
        if (ReadOnly)
        {
            return new { @class = CssClass, @readonly = "readonly" };
        }
        return new { @class = CssClass, @placeholder = PlaceHolder };
    }
}




@section ClientScripts {
    <script type='text/javascript'>
        $(function () {

            $("#FechaDesde").datepicker({ dateFormat: "dd/mm/yy" });
            $("#FechaHasta").datepicker({ dateFormat: "dd/mm/yy" });

            $("#btnBuscar").click(function (){
                $("#formBuscar").submit();
            });

            $('#crudtable').dataTable({
                "sDom": "<'row'<'col-sm-12'T><'col-sm-12'f>r>t<'row'<'col-sm-12'i><'col-sm-12'p>>",
                "bServerSide": false,
                "bAutoWidth": false,
                "bDestroy": true,
                "oTableTools": {
                    "sRowSelect": "single",
                    "aButtons": [
                    ]
                }
            });
            $('.dataTables_filter input').addClass('form-control').attr('style', 'display:none');
            $('.dataTables_length select').addClass('form-control');

        });
    </script>
}
<div id="page-content">
    <div id='wrap'>
        <div id="page-heading">
            <ol class="breadcrumb">
                <li class='active'><a href="index.php">Produccion</a></li>
                <li class='active'><a href="index.php">Estadisticas Registro</a></li>
            </ol>

            <h1>Estadisticas</h1>
        </div>


        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    @using (Html.BeginForm("Buscar", "ProduccionAdmin", FormMethod.Post, new { @id = "formBuscar", @class = "form-horizontal" }))
                    {
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                <h4>Informe Proceso/Parte</h4>
                                <div class="options">
                                    <a href="javascript:;"><i class="fa fa-cog"></i></a>
                                    <a href="javascript:;"><i class="fa fa-wrench"></i></a>
                                    <a href="javascript:;" class="panel-collapse"><i class="fa fa-chevron-down"></i></a>
                                </div>
                            </div>
                            <div class="panel-body collapse in">
                                <div class="form-group">
                                    <div class="row">
                                        <label for="focusedinput" class="col-xs-3 control-label">@Html.LabelFor(model => model.FechaDesde)</label>
                                        <div class="col-xs-3">
                                            @Html.TextBoxFor(model => model.FechaDesde, new { @class = "form-control" })
                                        </div>

                                        <label for="focusedinput" class="col-xs-3 control-label">@Html.LabelFor(model => model.FechaHasta)</label>
                                        <div class="col-xs-3">
                                            @Html.TextBoxFor(model => model.FechaHasta, new { @class = "form-control" })
                                        </div>
                                    </div>
                                    <div class="row">
                                        <label for="focusedinput" class="col-xs-3 control-label">@Html.LabelFor(model => model.IdParte)</label>
                                        <div class="col-sm-3">
                                            @Html.DropDownListFor(model => model.IdParte, new SelectList(Model.Partes, "IdParte", "Descripcion"), "Seleccionar Parte", @getHtmlAttributes(false, "form-control", ""))
                                        </div>

                                        <label for="focusedinput" class="col-xs-3 control-label">@Html.LabelFor(model => model.IdProceso)</label>
                                        <div class="col-sm-3">
                                            @Html.DropDownListFor(model => model.IdProceso, new SelectList(Model.Procesos, "IdProceso", "Descripcion"), "Seleccionar Proceso", @getHtmlAttributes(false, "form-control", ""))
                                        </div>
                                    </div>
                                    <div class="pull-right">
                                        <input type="button" id="btnBuscar" value="Buscar" class="btn-primary btn" />
                                    </div>
                                </div>
                                <!--table-->
                                <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered datatables" id="crudtable">
                                    <thead>
                                        <tr>
                                            <th width="30%">Proceso</th>
                                            <th width="20%">Parte</th>
                                            <th width="18%">Tiempo Promedio</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach (var item in ViewBag.Resultado)
                                        {
                                            <tr>
                                                <td>@item.NombreProceso</td>
                                                <td>@item.NombreParte</td>
                                                <td>@item.Promedio</td>
                                            </tr>
                                        }
                                    </tbody>
                                </table>
                                <!--end table-->
                            </div>
                        </div>
                    }
                </div>
            </div>
        </div> <!-- container -->
    </div> <!--wrap -->
</div> <!-- page-content -->